<template>
  <div class="lg:flex">
    <Avatar :src="userinfo.avatar || headerImg" :size="72" class="!mx-auto !block" />
    <div class="md:ml-6 flex flex-col justify-center md:mt-0 mt-2">
      <h1 class="md:text-lg text-md">{{ Greetings }}{{ value }} 开始您一天的工作吧！</h1>
      <span class="text-secondary">{{Weathers.country}}{{Weathers.city}} 时间:{{Weathers.date}} {{Weathers.week}} 天气状况:{{Weathers.wea}}</span>
    </div>
    <div class="flex flex-1 justify-end md:mt-0 mt-4">
      <div class="flex flex-col justify-center text-right">
        <span class="text-secondary"> 待办 </span>
        <span class="text-2xl">2/10</span>
      </div>

      <div class="flex flex-col justify-center text-right md:mx-16 mx-12">
        <span class="text-secondary"> 项目 </span>
        <span class="text-2xl">8</span>
      </div>
      <div class="flex flex-col justify-center text-right md:mr-10 mr-4">
        <span class="text-secondary"> 团队 </span>
        <span class="text-2xl">300</span>
      </div>
    </div>
  </div>
</template>
<script lang="ts" setup>
import { computed, reactive } from 'vue';
import { Avatar } from 'ant-design-vue';
import { useUserStore } from '/@/store/modules/user';
import headerImg from '/@/assets/images/header.jpg';
import  {Weather} from '/@/utils/http/axios/musterApi';

const userStore = useUserStore();
const userinfo: any = computed(() => userStore.getUserInfo);
const value = userinfo.value.name;
let date: Object = new Date().getHours();
let Greetings: string;
if (date < 12) {
  Greetings = '早上好！';
} else if (date >= 12 && date < 18) {
  Greetings = '下午好！';
} else {
  Greetings = '晚上好！';
}

const Weathers: any = reactive(
  {
  country:'',
  city:'',
  date:'',
  week:'',
  wea:''
  }
)
Weather()
  .then(a => {
     Weathers.country=a.data.country
     Weathers.city=a.data.city
     Weathers.date= a.data.data[0].date
     Weathers.week = a.data.data[0].week
     Weathers.wea= a.data.data[0].wea
     console.log(a);
     
  })
// {{Weathers.country}}{{Weathers.city}} 时间:{{Weathers.date}} {{Weathers.week}} 天气状况:{{Weathers.wea}}
</script>
